package hou.just4fun.HupuTweets.util;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author houweitao
 * @date 2016年5月5日 下午5:29:24
 */

public class LRUCache<K, V> extends LinkedHashMap<K, V> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 2726061586702274295L;

	private int cacheSize;

	public LRUCache(int cacheSize) {
		super(16, (float) 0.75, true);
		this.cacheSize = cacheSize;
	}

	@Override
	protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
		return size() >= cacheSize;
	}
}
